import Vue from 'vue'
import VueRouter from 'vue-router'
import register from '@/view/register'
import login from '@/view/login'
//引入home组件
import home from '@/view/home'
import demo from '@/view/demo'
import uploadFile from '@/view/uploadFile'
import goodsList from '@/view/goodsList'
import book from '@/view/book'
Vue.use(VueRouter)

const routes = [
	// 路由配置文件（router.js）


	{
		path: '/',
		redirect: '/login' // 将根路径重定向到 login 路由
	},
	{
		path: '/home',//路由地址
		name: 'home',
		component: home//相对应的组件
	},
	{
		path: '/register',
		component: register
	}, {
		path: '/login',
		component: login
	}, {
		path: '/demo',
		component: demo
	}, {
		path: '/uploadFile/:id',
		name: 'uploadFile',
		component: uploadFile
	}, {
		path: '/goodsList',
		component: goodsList
	}, {
		path: '/book',
		component: book
	}
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
});


export default router
